<template>
	<view>
		<template v-if="tip=='buttom'">
			<wbuttom :nature="nature"></wbuttom>
		</template>
		<template v-if="tip=='uporder'">
			<wforms :nature="nature"></wforms>
		</template>
		<template v-else>
			<err></err>
		</template>
	</view>
</template>

<script type="text/javascript">
	import wbuttom from "../widget/wbuttom"
	import wforms from "../widget/wforms"
	import err from "../widget/404"
	export default {
		props: ['name', 'data'],
		data: function() {
			return {
				nature: {},
				tip: this.name
			}
		},
		mounted() {
			let that = this;
			var formdata = {};
			formdata['name'] = that.tip;
			Object.assign(formdata, that.data);
			this.$http.postf('dagger?operation=WidgetService', formdata).then(res => {
				if (res.statusCode == 200) {
					that.nature = JSON.parse(res.data)
				} else {
					uni.showToast({
						title: '加载雷霆组件失败',
						duration: 2000,
						icon: "none"
					})
				}
			})
		},
		components: {
			wbuttom,
			wforms,
			err
		}
	}
</script>
<style lang="scss" scoped>
</style>
